package cn.iniche.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import okhttp3.OkHttpClient;


public final class SingletonHelper {

    private static OkHttpClient okHttpClient;
    private static Gson gson;

    public static OkHttpClient getOkHttpClient() {
        if (okHttpClient == null) {
            synchronized (SingletonHelper.class) {
                if (okHttpClient == null) {
                    okHttpClient = new OkHttpClient.Builder().build();
                }
            }
        }
        return okHttpClient;
    }


    public static Gson getGson() {
        if (gson == null) {
            synchronized (SingletonHelper.class) {
                if (gson == null) {
                    gson = new GsonBuilder().disableHtmlEscaping().serializeNulls().create();
                }
            }
        }
        return gson;
    }
}
